<template>
  <div>
    <div>
      <div class="search-box">
        <el-input type="text" v-model="data.search" placeholder="搜索" @keyup.enter="search">
          <template #suffix>
            <yu-icon @click="search" iconName="chaxun" class="search-icon" />
          </template>
        </el-input>
      </div>
    </div>
    <ul class="nav-class">
      <li v-for="item in data.nav" @click="changeType(item)">{{ item.name }}</li>
    </ul>
  </div>
</template>

<script setup>
  import { reactive, ref, getCurrentInstance } from 'vue';
  let { proxy } = getCurrentInstance();
  import { systemStore } from '@/pinia/system';
  const store = systemStore();
  const data = reactive({ nav: [] });
  data.nav = [
    { name: '都市', url: 'http://' },
    { name: '玄幻', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
    { name: '异界', url: 'http://' },
  ];
  const changeType = item => {
    console.log(item);
    store.changeBook('search');
  };
</script>
<style lang="scss" scoped>
  .search-box {
    height: 40px;
    :deep(.el-input--suffix .el-input__inner) {
      height: 40px;
      font-size: 16px;
    }
    svg {
      font-size: 22px;
    }
    .search-icon {
      cursor: pointer;
    }
  }
  .nav-class {
    width: 80%;
    background: #0a2572;
    height: 50px;
    padding-left: 20%;
    line-height: 50px;

    li {
      display: inline;
      padding: 0 15px;
      cursor: pointer;
      color: #ffffff;
      font-weight: 400;
    }
    li:hover {
      color: #e91a1a;
    }
  }
</style>
